class RequestCache:
    
    def __init__(self, key, REQUEST):
        
        if not hasattr(REQUEST,'_CACHE'):
            REQUEST.set('_CACHE', {})
    
        if key not in REQUEST._CACHE:
            REQUEST._CACHE[key] = {}
    
        self.cache = REQUEST._CACHE[key]
        
    def __getitem__(self, key):
        return self.cache[key]
            
    def __setitem__(self, key, value):
        self.cache[key] = value
        
    def __iter__(self):
        return self.cache.__iter__()        